import book.BookList;
import user.AdminUser;
import user.NormalUser;
import user.User;

import java.util.Scanner;

/**
 * @author HW
 */
public class Main {
    public static User longin() {
        System.out.println("请输入你的姓名：");
        Scanner scanner=new Scanner(System.in);
        String name=scanner.nextLine();
        System.out.println("请输入你的身份：0——》普通用户  1——》管理员");
        int id= scanner.nextInt();
        if(id==1){
            return new AdminUser(name);
        }else{
            return new NormalUser(name);
        }

    }
    public static void main(String[] args) {
        BookList booklist = new BookList();
        User user=longin();
        while (true) {
            int choice = user.menu();//根据不同用户，实现不同操作
            user.doWork(choice, booklist);
          
        }
    }

}
